package com.chain.BrotherExchange.ui.dialog;

import android.app.Dialog;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.transition.TransitionManager;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.chain.BrotherExchange.R;
import com.chain.BrotherExchange.utils.ImageViews;

public class LookImageViewDialog extends Dialog {

    public static void show(Context context, String url) {
        new LookImageViewDialog(context, url).show();
    }

    private LookImageViewDialog(@NonNull Context context, String url) {
        super(context);

        ViewGroup contentView = (ViewGroup) LayoutInflater.from(context).inflate(R.layout.dialog_look_image_view, null);
        addContentView(contentView, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
                LinearLayout.LayoutParams.MATCH_PARENT));
        ImageView qrCodeImageView = contentView.findViewById(R.id.receipt_qr_code_image);
        TransitionManager.beginDelayedTransition(contentView);
        ImageViews.load(url, qrCodeImageView);
    }
}
